package com.zjr.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate4.support.HibernateDaoSupport;

import com.zjr.dao.DepartmentDao;
import com.zjr.domain.Department;
/**
 * 部门DAO层实现类
 * */
public class DepartmetnDaoImpl extends HibernateDaoSupport implements DepartmentDao {
	
	//查询所有部门
	@Override
	public List<Department> findAll() {
		return (List<Department>) this.getHibernateTemplate().find("from Department");
	}
	
	//添加部门
	@Override
	public void save(Department department) {
		try {
			this.getHibernateTemplate().save(department);
		} catch (Exception e) {
			e.printStackTrace();
		}	
	}
	
}
